import request from '@/utils/request'

// 字典类型管理
export const getDictTypes = (params) => {
    return request({
        url: 'dict/getDictTypes',
        method: 'get',
        params
    })
}

export const saveDictType = (data) => {
    return request({
        url: 'dict/saveDictType',
        method: 'post',
        data
    })
}

export const deleteDictType = (data) => {
    return request({
        url: 'dict/deleteDictType',
        method: 'post',
        data
    })
}

// 字典数据管理
export const getDictData = (params) => {
    return request({
        url: 'dict/getDictData',
        method: 'get',
        params
    })
}

export const saveDictData = (data) => {
    return request({
        url: 'dict/saveDictData',
        method: 'post',
        data
    })
}

export const deleteDictData = (data) => {
    return request({
        url: 'dict/deleteDictData',
        method: 'post',
        data
    })
}

// 获取所有字典类型（下拉选择用）
export const getAllDictTypes = () => {
    return request({
        url: 'dict/getAllDictTypes',
        method: 'get'
    })
}

// 根据字典类型获取字典数据（前端选择用）
export const getDictDataByType = (params) => {
    return request({
        url: 'dict/getDictDataByType',
        method: 'get',
        params
    })
}